<h1>Listing computers</h1>

<% link_to new_computer_path, :class => 'ui-state-default ui-corner-all dialog_link' do %>
	<span class="ui-icon ui-icon-plus"></span>New computer
<% end %>

<table>
  <tr class="ui-state-default">
    <th>Name</th>
    <th>Os</th>
    <th>Mac address</th>
    <th>Ip address</th>
    <th>Start date</th>
    <th>Status</th>
    <th>Network</th>
    <th>Room</th>
	<th></th>
	<th></th>
  </tr>

<% @computers.each do |computer| %>
  <tr>
    <td><%=h computer.name %></td>
    <td><%=h computer.os %></td>
    <td><%=h computer.mac_address %></td>
    <td><%=h computer.ip_address %></td>
    <td><%=h computer.start_date %></td>
    <td><%=h Computer::COMPUTER_STATUS[computer.status]%></td>
    <td><% if computer.network != nil %><%=h computer.network.name %><%end%></td>
    <td><% if computer.room != nil%><%if computer.room.company != nil %><%=h "#{computer.room.company.name} : " %><%end%><%= "#{computer.room.code}" %><%end%></td>
	<td>
    	<% link_to computer, :class => "ui-state-default ui-corner-all dialog_link" do %>
			<span class="ui-icon ui-icon-search"></span>View
		<% end %>
	</td>
	<td>
		<% link_to computer, :confirm => 'Are you sure ?', :method => :delete, :class => "ui-state-error ui-corner-all dialog_link ui-state-hover" do %>
			<span class="ui-icon ui-icon-close"></span>Destroy
		<% end %>
	</td>
  </tr>
<% end %>
</table>


